<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <div class="list">
      <div
        class="list-left"
        :style="{
          'background-image': `url(${publicUrls + 'free/style3/exhibitionStandStyle4bg1.webp'})`,
        }"
      ></div>
      <div
        class="item-parent"
        :style="{
          'background-image': `url(${publicUrls + 'free/style3/exhibitionStandStyle4bg2.webp'})`,
        }"
      >
        <div
          @contextmenu.stop="emit('onContextMenuChild', $event, index)"
          v-for="(item, index) in props.info.showpieceList"
          :key="index"
          class="exhibits-item"
        >
          <!-- exhibitionStandStyle2bg1 -->
          <div
            class="item-content"
            :style="{
              'background-image': `url(${
                publicUrls + 'free/style3/exhibitionStandStyle4bg4.webp'
              })`,
            }"
          >
            <div class="cover-box">
              <img
                class="cover"
                v-lazy="getLinkUrl(item.coverUrl, '?imageView2/3/w/600/format/webp')"
                alt=""
                @click="viewImg(item.moduleId, item.id)"
              />
              <!-- <div class="flower-btn">
                <div></div>
              </div> -->
              <div class="items-shadow">
                <p class="items-title">
                  {{ item.name }}
                </p>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div
        class="list-right"
        :style="{
          'background-image': `url(${publicUrls + 'free/style3/exhibitionStandStyle4bg3.webp'})`,
        }"
      ></div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
// import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { getLinkUrl } from '@/utils/request/upload';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
// watch(
//   () => props.info.width,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );
// watch(
//   () => props.info.height,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );

//
</script>

<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  z-index: 999;
  padding: 0 !important;
  -webkit-box-reflect: none !important;
}
.list-left,
.list-right {
  width: 330px;
  height: 609px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.item-parent {
    display: flex;
  flex: 1;
  height: 609px;
  background-repeat: repeat;
  background-size: auto 100%;
}
.list {
  display: flex;
  padding: 0;
  width: 100%;
  height: 100%;
}
.active {
  :deep(.flot-menu) {
    display: flex;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) {
  z-index: 66;
}
.flower-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.3);
  border: 3px solid #ffffff;
  border-radius: 50%;
  div {
    width: 12.5px;
    height: 12.5px;
    background: #ffffff;
    border-radius: 50%;
  }
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 6;
  transform: translate(-50%, -50%);
  animation: flower 2s linear infinite;
  @keyframes flower {
    0% {
      opacity: 0;
    }
    40% {
      opacity: 100%;
    }
    80% {
      opacity: 100%;
    }
    100% {
      opacity: 0;
    }
  }
}
.exhibits-item {
  display: flex;
  justify-content: center;
  position: relative;
  width: 487px;
  height: 609px;
}

.item-content {
    display: flex;
  width: 380px;
  height: 429px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  margin-top: 98px;
  padding: 59px 12px 4px 4px;
}
.cover-box {

  position: relative;
  width: 364px;
  height: 366px;
  overflow: hidden;
 
}
.cover {
  width: 364px;
  height: 366px;
  object-fit: contain;
  transition: all 0.3s;
}
.cover-box:hover {
  .items-shadow {
    opacity: 1;
  }
}
.items-shadow {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;
  width: 364px;
  height: 100%;
  background: rgba(35, 20, 16, 0.8);
  opacity: 0;
}
.items-title {
  width: 306px;
  height: 28px;
  font-family: SourceHanSerifCN-Bold;
  font-size: 18px;
  color: #ece5d9;
  line-height: 28px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
</style>
